package com.hqyj.onlineExamination.modules.exam.dao;

import com.hqyj.onlineExamination.modules.common.entity.SearchBean;
import com.hqyj.onlineExamination.modules.exam.entity.Achievement;
import com.hqyj.onlineExamination.modules.exam.entity.Question;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author yun
 * @date 2021-6-10 15:03
 */
@Mapper//把这个DAO交给Spring管理
@Repository//将类识别为Bean
public interface CorrectDao {

    //查询所有的未批改的试卷
    @Select("<script>"
            + "select * from exam_achievement "
            + "<where> "
            + "<if test='keyWord != \"\" and keyWord != null'>"
            + " and (score like '%${keyWord}%') "
            + "</if>"
            + "</where>"
            + "<choose>"
            + "<when test='orderBy != \"\" and orderBy != null'>"
            + " order by ${orderBy} ${direction}"
            + "</when>"
            + "<otherwise>"
            + " order by id desc"
            + "</otherwise>"
            + "</choose>"
            + "</script>")
    List<Achievement> selectAlCorrect(SearchBean searchBean);
}
